<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>File saving</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="index.html" title="The gdk-pixbuf Library">
<link rel="up" href="rn01.html" title="API Reference">
<link rel="prev" href="gdk-pixbuf-file-loading.html" title="File Loading">
<link rel="next" href="gdk-pixbuf-creating.html" title="Image Data in Memory">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="rn01.html" title="API Reference">
<link rel="reference" href="rn02.html" title="Tools Reference">
<link rel="index" href="api-index-full.html" title="Index of all symbols">
<link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
<link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
<link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
<link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
<link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
<link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
<link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
<link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
<link rel="appendix" href="apa.html" title="Appendix A. Porting applications from Imlib to gdk-pixbuf">
<link rel="appendix" href="license.html" title="Appendix B. License">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-pixbuf-file-loading.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="rn01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">The gdk-pixbuf Library</th>
<td><a accesskey="n" href="gdk-pixbuf-creating.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-pixbuf-file-saving.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#gdk-pixbuf-file-saving.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-pixbuf-file-saving"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-pixbuf-file-saving.top_of_page"></a>File saving</span></h2>
<p>File saving — Saving a pixbuf to a file.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-pixbuf-file-saving.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gdk-pixbuf/gdk-pixbuf.h&gt;

<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-savev" title="gdk_pixbuf_savev ()">gdk_pixbuf_savev</a>                    (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         const char *filename,
                                                         const char *type,
                                                         char **option_keys,
                                                         char **option_values,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()">gdk_pixbuf_save</a>                     (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         const char *filename,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            (<a class="link" href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()">*GdkPixbufSaveFunc</a>)                (const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
>gsize</a> count,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()">gdk_pixbuf_save_to_callback</a>         (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a class="link" href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()">GdkPixbufSaveFunc</a> save_func,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callbackv" title="gdk_pixbuf_save_to_callbackv ()">gdk_pixbuf_save_to_callbackv</a>        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a class="link" href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()">GdkPixbufSaveFunc</a> save_func,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                                         const char *type,
                                                         char **option_keys,
                                                         char **option_values,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-buffer" title="gdk_pixbuf_save_to_buffer ()">gdk_pixbuf_save_to_buffer</a>           (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-bufferv" title="gdk_pixbuf_save_to_bufferv ()">gdk_pixbuf_save_to_bufferv</a>          (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                                         const char *type,
                                                         char **option_keys,
                                                         char **option_values,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-stream" title="gdk_pixbuf_save_to_stream ()">gdk_pixbuf_save_to_stream</a>           (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a
href="/usr/share/gtk-doc/html/gio/GOutputStream.html"
>GOutputStream</a> *stream,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/gio/GCancellable.html"
>GCancellable</a> *cancellable,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="gdk-pixbuf-file-saving.description"></a><h2>Description</h2>
<p>
These functions allow to save a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> in a number of
file formats. The formatted data can be written to a file
or to a memory buffer. <span class="application">gdk-pixbuf</span> can also call a user-defined
callback on the data, which allows to e.g. write the image
to a socket or store it in a database.
</p>
</div>
<div class="refsect1" lang="en">
<a name="gdk-pixbuf-file-saving.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-savev"></a><h3>gdk_pixbuf_savev ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_savev                    (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         const char *filename,
                                                         const char *type,
                                                         char **option_keys,
                                                         char **option_values,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Saves pixbuf to a file in <em class="parameter"><code>type</code></em>, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
If <em class="parameter"><code>error</code></em> is set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> will be returned. 
See <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> name of file to save.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>option_keys</code></em> :</span></p></td>
<td> name of options to set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>-terminated
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>option_values</code></em> :</span></p></td>
<td> values for named options
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether an error was set
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-save"></a><h3>gdk_pixbuf_save ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_save                     (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         const char *filename,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);</pre>
<p>
Saves pixbuf to a file in format <em class="parameter"><code>type</code></em>. By default, "jpeg", "png", "ico" 
and "bmp" are possible file formats to save in, but more formats may be
installed. The list of all writable formats can be determined in the 
following way:
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
void add_if_writable (GdkPixbufFormat *data, GSList **list)
{
  if (gdk_pixbuf_format_is_writable (data))
    *list = g_slist_prepend (*list, data);
}

GSList *formats = gdk_pixbuf_get_formats ();
GSList *writable_formats = NULL;
g_slist_foreach (formats, add_if_writable, &amp;writable_formats);
g_slist_free (formats);
</pre></div>
<p>
</p>
<p>
If <em class="parameter"><code>error</code></em> is set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> will be returned. Possible errors include 
those in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR--CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> domain and those in the <a
href="/usr/share/gtk-doc/html/glib/glib-File-Utilities.html#G-FILE-ERROR--CAPS"
><span class="type">G_FILE_ERROR</span></a> domain.
</p>
<p>
The variable argument list should be <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>-terminated; if not empty,
it should contain pairs of strings that modify the save
parameters. For example:
</p>
<div class="informalexample"><pre class="programlisting">
gdk_pixbuf_save (pixbuf, handle, "jpeg", &amp;error,
                 "quality", "100", NULL);
</pre></div>
<p>
</p>
<p>
Currently only few parameters exist. JPEG images can be saved with a
"quality" parameter; its value should be in the range [0,100].
</p>
<p>
Text chunks can be attached to PNG images by specifying parameters of
the form "tEXt::key", where key is an ASCII string of length 1-79.
The values are UTF-8 encoded strings. The PNG compression level can
be specified using the "compression" parameter; it's value is in an
integer in the range of [0,9].
</p>
<p>
ICO images can be saved in depth 16, 24, or 32, by using the "depth"
parameter. When the ICO saver is given "x_hot" and "y_hot" parameters,
it produces a CUR instead of an ICO.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td> name of file to save.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether an error was set
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="GdkPixbufSaveFunc"></a><h3>GdkPixbufSaveFunc ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            (*GdkPixbufSaveFunc)                (const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *buf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
>gsize</a> count,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);</pre>
<p>
Specifies the type of the function passed to
<a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a>.  It is called once for each block of
bytes that is "written" by <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a>.  If
successful it should return <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a>.  If an error occurs it should set
<em class="parameter"><code>error</code></em> and return <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a>, in which case <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a>
will fail with the same error.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td>bytes to be written.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
<td>number of bytes in <em class="parameter"><code>buf</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>A location to return an error.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td>user data passed to <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>%TRUE if successful, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> (with <em class="parameter"><code>error</code></em> set) if failed.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-save-to-callback"></a><h3>gdk_pixbuf_save_to_callback ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_save_to_callback         (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a class="link" href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()">GdkPixbufSaveFunc</a> save_func,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);</pre>
<p>
Saves pixbuf in format <em class="parameter"><code>type</code></em> by feeding the produced data to a 
callback. Can be used when you want to store the image to something 
other than a file, such as an in-memory buffer or a socket.  
If <em class="parameter"><code>error</code></em> is set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> will be returned. Possible errors
include those in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR--CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> domain and whatever the save
function generates.
</p>
<p>
See <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>save_func</code></em> :</span></p></td>
<td> a function that is called to save each block of data that
  the save routine generates.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> user data to pass to the save function.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-save-to-callbackv"></a><h3>gdk_pixbuf_save_to_callbackv ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_save_to_callbackv        (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a class="link" href="gdk-pixbuf-file-saving.html#GdkPixbufSaveFunc" title="GdkPixbufSaveFunc ()">GdkPixbufSaveFunc</a> save_func,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                                         const char *type,
                                                         char **option_keys,
                                                         char **option_values,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Saves pixbuf to a callback in format <em class="parameter"><code>type</code></em>, which is currently "jpeg",
"png", "tiff", "ico" or "bmp".  If <em class="parameter"><code>error</code></em> is set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> will be returned. See
<a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a> for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>save_func</code></em> :</span></p></td>
<td> a function that is called to save each block of data that
  the save routine generates.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> user data to pass to the save function.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>option_keys</code></em> :</span></p></td>
<td> name of options to set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>-terminated
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>option_values</code></em> :</span></p></td>
<td> values for named options
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-save-to-buffer"></a><h3>gdk_pixbuf_save_to_buffer ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_save_to_buffer           (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);</pre>
<p>
Saves pixbuf to a new buffer in format <em class="parameter"><code>type</code></em>, which is currently "jpeg",
"png", "tiff", "ico" or "bmp".  This is a convenience function that uses
<a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-callback" title="gdk_pixbuf_save_to_callback ()"><code class="function">gdk_pixbuf_save_to_callback()</code></a> to do the real work. Note that the buffer 
is not nul-terminated and may contain embedded  nuls.
If <em class="parameter"><code>error</code></em> is set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> will be returned and <em class="parameter"><code>buffer</code></em> will be set to
<a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>. Possible errors include those in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR--CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a>
domain.
</p>
<p>
See <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save" title="gdk_pixbuf_save ()"><code class="function">gdk_pixbuf_save()</code></a> for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td> location to receive a pointer to the new buffer.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer_size</code></em> :</span></p></td>
<td> location to receive the size of the new buffer.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-save-to-bufferv"></a><h3>gdk_pixbuf_save_to_bufferv ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_save_to_bufferv          (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> **buffer,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gsize"
>gsize</a> *buffer_size,
                                                         const char *type,
                                                         char **option_keys,
                                                         char **option_values,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error);</pre>
<p>
Saves pixbuf to a new buffer in format <em class="parameter"><code>type</code></em>, which is currently "jpeg",
"tiff", "png", "ico" or "bmp".  See <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-buffer" title="gdk_pixbuf_save_to_buffer ()"><code class="function">gdk_pixbuf_save_to_buffer()</code></a> 
for more details.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td> location to receive a pointer to the new buffer.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer_size</code></em> :</span></p></td>
<td> location to receive the size of the new buffer.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>option_keys</code></em> :</span></p></td>
<td> name of options to set, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>-terminated
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>option_values</code></em> :</span></p></td>
<td> values for named options
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> whether an error was set

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-pixbuf-save-to-stream"></a><h3>gdk_pixbuf_save_to_stream ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            gdk_pixbuf_save_to_stream           (<a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf">GdkPixbuf</a> *pixbuf,
                                                         <a
href="/usr/share/gtk-doc/html/gio/GOutputStream.html"
>GOutputStream</a> *stream,
                                                         const char *type,
                                                         <a
href="/usr/share/gtk-doc/html/gio/GCancellable.html"
>GCancellable</a> *cancellable,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"
>GError</a> **error,
                                                         ...);</pre>
<p>
Saves <em class="parameter"><code>pixbuf</code></em> to an output stream.
</p>
<p>
Supported file formats are currently "jpeg", "tiff", "png", "ico" or 
"bmp". See <a class="link" href="gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-buffer" title="gdk_pixbuf_save_to_buffer ()"><code class="function">gdk_pixbuf_save_to_buffer()</code></a> for more details.
</p>
<p>
The <em class="parameter"><code>cancellable</code></em> can be used to abort the operation from another 
thread. If the operation was cancelled, the error <code class="literal">GIO_ERROR_CANCELLED</code> 
will be returned. Other possible errors are in the <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GDK-PIXBUF-ERROR--CAPS" title="GDK_PIXBUF_ERROR"><span class="type">GDK_PIXBUF_ERROR</span></a> 
and <a
href="/usr/share/gtk-doc/html/gio/gio-GIOError.html#G-IO-ERROR--CAPS"
><code class="literal">G_IO_ERROR</code></a> domains. 
</p>
<p>
The stream is not closed.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td> a <a
href="/usr/share/gtk-doc/html/gio/GOutputStream.html"
><span class="type">GOutputStream</span></a> to save the pixbuf to
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td>
<td> name of file format
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td> optional <a
href="/usr/share/gtk-doc/html/gio/GCancellable.html"
><span class="type">GCancellable</span></a> object, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> to ignore
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td> return location for error, or <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td> list of key-value save options
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a> if the pixbuf was saved successfully, <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> if an
    error was set.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>
